<?php include './application/views/common/header.php'; ?>
<script type="text/javascript" src="/static/js/formCheck.js"></script>
<!--dd_position end-->
   <div class="dd_account">
   
<?php include './application/views/common/user_left.php'; ?>
<!-- User_Left End -->

<div class="account_user_con" style="min-height:814px;">
       <div class="user_con_box">
	   <div class="user_list_title">
         <div class="user_con_tab">
	          <ul>
	        	 <li class="current7"><a href="/amount/index/index.html">额度申请</a></li>
	          </ul>
		</div>
		</div>
         <div class="user_con_detail">
         	<table width="100%" border="0"cellpadding="0" style="text-align:center; ">
	         <tr>	
				<td style="background-color:#eee; font-weight:bold;height:38px;"><strong>申请时间</strong></td>
				<td style="background-color:#eee; font-weight:bold;height:38px;"><strong>申请额度</strong></td>
				<td style="background-color:#eee; font-weight:bold;height:38px;"><strong>原来额度</strong></td>
				<td style="background-color:#eee; font-weight:bold;height:38px;"><strong>新额度</strong></td>
			  </tr>
			  
			  <?php $i=0; foreach($amount_apply_list as $amount_apply){?>
			  <tr <?php if($i%2==0){?> class="table_gray"<?php }?>>
				<td><?php echo date('Y-m-d H:i:s',$amount_apply['add_time']);?></td>
				<td><?php echo number_format($amount_apply['account'],2);?></td>
				<td><?php echo number_format($amount_apply['account_old'],2);?></td>
				<td><?php echo number_format($amount_apply['account_new'],2);?></td>
			  </tr>
			  <?php $i++; }?>
			</table>

         		<form id="amountForm" name="amountForm">
			          <ul>
			           <li>
			             <dd>申请类型：</dd>
			            <dt>
			            	<select name="ftype" class="pubinput">
								<option value="0">请选择类型</option>
					  			<?php foreach($types as $k => $v) { ?>
					  			<option value="<?php echo $k; ?>" ><?php echo $v; ?></option>
					  			<?php } ?>
						  	</select>
			            </dt> 
			          </li>
			           <li>
			             <dd>申请金额：</dd>
			            <dt>
			            	<input type="text" class="pubinput" id="account" name="account" />
			            </dt> 
			          </li>
			           <li>
			             <dd>说明：</dd>
			            <dt>
			            	<textarea rows="2" class="pubinput" cols="40" id="remark" name="remark"></textarea>
			            </dt> 
			          </li>
			           
			          <li style="text-align:center;">
			          <input class="little_button" type="button" onclick="amountSubmit();" style="" value="确 认 修 改">
			          </li>
			          </ul>
          		</form>
         	
         	
       </div>
       </div>
     </div>
   </div>
<!--dd_account end-->
 
 




<script type="text/javascript">
function amountSubmit(){
	var options = {
		url : '/amount/apply/',
		clearForm :true,
		resetForm :true,
		beforeSubmit:  checkForm,
		dataType: "json",
		type:"post",
		success : function(ret) {
			if(ret.msg==''){
				$('#dialog').dialog({
					modal:true,
					title:'系统提示',
					buttons:{"确定":function(){$(this).dialog("close");}},
					close: function() {
						location=ret.url;
					}
				}); 
				$("#msg").html("操作成功");
			}else{
				$('#dialog').dialog({
					modal:true,
					title:'系统提示',
					buttons:{"确定":function(){$(this).dialog("close");}},
					close: function() {
						location=ret.url;
					}
				}); 
				$("#msg").html(ret.msg);
			}
		}
	};
	$("#amountForm").ajaxSubmit(options);
	return false;
}

function checkForm(){
	var err = '';
	if(IsDouble($('#account').val())==false){
		err = '请填写有效的额度';
	}else if($('#remark').val()==''){
		err = '请填写有效的备注';
	}
	
	if(err==''){
		return true;
	}else{
		$('#dialog').dialog({
			modal:true, //蒙层（弹出会影响页面大小）
			title:'系统提示',
			buttons:{"确定":function(){$(this).dialog("close");}}
		}); 
		$("#msg").html(err);
		return false;
	}
}
</script>
<?php include './application/views/common/footer.php'; ?>